'\" te
.\" Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved
.\" Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH MKFS_UFS 8 "Mar 8, 2006"
.SH NAME
mkfs_ufs \- construct a UFS file system
.SH SYNOPSIS
.LP
.nf
\fBmkfs\fR \fB-F\fR ufs [\fIgeneric_options\fR] [\fB-o\fR \fIFSType_specific_options\fR] \fIraw_device_file\fR
     [\fIsize\fR]
.fi

.SH DESCRIPTION
.sp
.LP
The UFS-specific module of \fBmkfs\fR builds a UFS file system with a root
directory and a \fBlost+found\fR directory (see \fBfsck\fR(8)).
.sp
.LP
The UFS-specific \fBmkfs\fR is rarely run directly. Use the \fBnewfs\fR(8)
command instead.
.sp
.LP
\fIraw_device_file\fR indicates the disk partition on which to create the new
file system. If the \fB-o\fR \fBN\fR, \fB-V\fR, or \fB-m\fR options are
specified, the \fIraw_device_file\fR is not actually modified. \fIsize\fR
specifies the number of disk sectors in the file system, where a disk sector is
usually 512 bytes. This argument must follow the \fIraw_device_file\fR argument
and is required (even with \fB\fR\fB-o\fR\fB N\fR), unless the \fB-V\fR or
\fB-m\fR generic options are specified.
.sp
.LP
\fIgeneric_options\fR are supported by the generic \fBmkfs\fR command. See
\fBmkfs\fR(8) for a description of these options.
.SH OPTIONS
.sp
.LP
The following generic options are supported:
.sp
.ne 2
.na
\fB\fB-m\fR\fR
.ad
.RS 6n
Print the command line that was used to create the existing file system.
.RE

.sp
.ne 2
.na
\fB\fB-V\fR\fR
.ad
.RS 6n
Print the current \fBmkfs\fR command line.
.RE

.SH OPTIONS
.sp
.LP
The following UFS-specific options are supported:
.sp
.ne 2
.na
\fB\fB-o\fR\fR
.ad
.RS 6n
Use one or more of the following values separated by commas (with no
intervening spaces) to specify UFS-specific options:
.sp
.ne 2
.na
\fB\fBapc=\fR\fIn\fR\fR
.ad
.RS 15n
The number of alternate sectors per cylinder to reserve for bad block
replacement for SCSI devices only. The default is \fB0\fR.
.sp
This option is not applicable for disks with EFI labels and is ignored.
.RE

.sp
.ne 2
.na
\fB\fBbsize=\fR\fIn\fR\fR
.ad
.RS 15n
The logical block size of the file system in bytes, either \fB4096\fR or
\fB8192\fR. The default is \fB8192\fR. The sun4u architecture does not support
the \fB4096\fR block size.
.RE

.sp
.ne 2
.na
\fB\fBcalcbinsb\fR\fR
.ad
.RS 15n
Sends to stdout a binary (machine-readable) version of the superblock that
would be used to create a file system with the specified configuration
parameters.
.RE

.sp
.ne 2
.na
\fB\fBcalcsb\fR\fR
.ad
.RS 15n
Sends to stdout a human-readable version of the superblock that would be used
to create a file system with the specified configuration parameters.
.RE

.sp
.ne 2
.na
\fB\fBcgsize=\fR\fIn\fR\fR
.ad
.RS 15n
The number of cylinders per cylinder group, ranging from \fB16\fR to \fB256\fR.
The default is calculated by dividing the number of sectors in the file system
by the number of sectors in a gigabyte. Then, the result is multiplied by
\fB32\fR. The default value is always between \fB16\fR and \fB256\fR.
.sp
The per-cylinder-group meta data must fit in a space no larger than what is
available in one logical file system block. If too large a \fBcgsize\fR is
requested, it is changed by the minimum amount necessary.
.RE

.sp
.ne 2
.na
\fB\fBfragsize=\fR\fIn\fR\fR
.ad
.RS 15n
The smallest amount of disk space in bytes that can be allocated to a file.
\fBfragsize\fR must be a power of 2 divisor of \fBbsize\fR, where:
.sp
\fBbsize\fR / \fBfragsize\fR is 1, 2, 4, or 8.
.sp
This means that if the logical block size is \fB4096\fR, legal values for
\fBfragsize\fR are \fB512\fR, \fB1024\fR, \fB2048\fR, and \fB4096\fR. When the
logical block size is \fB8192\fR, legal values are \fB1024\fR, \fB2048\fR,
\fB4096\fR, and \fB8192\fR. The default value is \fB1024\fR.
.sp
For file systems greater than 1 terabyte or for file systems created with the
\fBmtb=y\fR option, \fBfragsize\fR is forced to match block size (\fBbsize\fR).
.RE

.sp
.ne 2
.na
\fB\fBfree=\fR\fIn\fR\fR
.ad
.RS 15n
The minimum percentage of free space to maintain in the file system between 0%
and 99%, inclusively. This space is off-limits to users. Once the file system
is filled to this threshold, only the superuser can continue writing to the
file system.
.sp
The default is ((64 Mbytes/partition size) * 100), rounded down to the nearest
integer and limited between 1% and 10%, inclusively.
.sp
This parameter can be subsequently changed using the \fBtunefs\fR(8) command.
.RE

.sp
.ne 2
.na
\fB\fBgap=\fR\fIn\fR\fR
.ad
.RS 15n
Rotational delay. This option is obsolete in the Solaris 10 release. The value
is always set to \fB0\fR, regardless of the input value.
.RE

.sp
.ne 2
.na
\fB\fBmaxcontig=\fR\fIn\fR\fR
.ad
.RS 15n
The maximum number of logical blocks, belonging to one file, that are allocated
contiguously. The default is calculated as follows:
.sp
.in +2
.nf
\fBmaxcontig =\fR \fIdisk drive maximum transfer size / disk block size\fR
.fi
.in -2
.sp

If the disk drive's maximum transfer size cannot be determined, the default
value for \fBmaxcontig\fR is calculated from kernel parameters as follows:
.sp
If \fBmaxphys\fR is less than \fBufs_maxmaxphys\fR, which is typically 1 Mbyte,
then \fBmaxcontig\fR is set to \fBmaxphys\fR. Otherwise, \fBmaxcontig\fR is set
to \fBufs_maxmaxphys\fR.
.sp
You can set \fBmaxcontig\fR to any positive integer value.
.sp
The actual value will be the lesser of what has been specified and what the
hardware supports.
.sp
You can subsequently change this parameter by using \fBtunefs\fR(8).
.RE

.sp
.ne 2
.na
\fB\fBmtb=y\fR\fR
.ad
.RS 15n
Set the parameters of the file system to allow eventual growth to over a
terabyte in total file system size. This option sets \fIfragsize\fR to be the
same as \fIbsize\fR, and sets \fInbpi\fR to 1 Mbyte, unless the \fB-i\fR option
is used to make it even larger. If you explicitly set the \fIfragsize\fR or
\fInbpi\fR parameters to values that are incompatible with this option, the
user-supplied value of \fIfragsize\fR or \fInbpi\fR is ignored.
.RE

.sp
.ne 2
.na
\fB\fBN\fR\fR
.ad
.RS 15n
Print out the file system parameters that would be used to create the file
system without actually creating the file system.
.RE

.sp
.ne 2
.na
\fB\fBnbpi=\fR\fIn\fR\fR
.ad
.RS 15n
The number of bytes per inode, which specifies the density of inodes in the
file system. The number is divided into the total size of the file system to
determine the number of inodes to create.
.sp
This value should reflect the expected average size of files in the file
system. If fewer inodes are desired, a larger number should be used. To create
more inodes, a smaller number should be given. The default is \fB2048\fR.
.sp
The number of inodes can increase if the file system is expanded with the
\fBgrowfs\fR command.
.RE

.sp
.ne 2
.na
\fB\fBnrpos=\fR\fIn\fR\fR
.ad
.RS 15n
The number of different rotational positions in which to divide a cylinder
group. The default is \fB8\fR.
.sp
This option is not applicable for disks with EFI labels and is ignored.
.RE

.sp
.ne 2
.na
\fB\fBnsect=\fR\fIn\fR\fR
.ad
.RS 15n
The number of sectors per track on the disk. The default is \fB32\fR.
.RE

.sp
.ne 2
.na
\fB\fBntrack=\fR\fIn\fR\fR
.ad
.RS 15n
The number of tracks per cylinder on the disk. The default is \fB16\fR.
.sp
This option is not applicable for disks with EFI labels and is ignored.
.RE

.sp
.ne 2
.na
\fB\fBopt=\fR\fIs\fR\||\|\fIt\fR\fR
.ad
.RS 15n
The file system can either be instructed to try to minimize the \fBtime\fR
spent allocating blocks, or to try to minimize the \fBspace\fR fragmentation on
the disk. The default is \fItime\fR.
.sp
This parameter can be subsequently changed with the \fBtunefs\fR(8) command.
.RE

.sp
.ne 2
.na
\fB\fBrps=\fR\fIn\fR\fR
.ad
.RS 15n
The rotational speed of the disk, in revolutions per second. The default is
\fB60\fR.
.sp
Note that you specify \fIrps\fR for \fBmkfs\fR and \fIrpm\fR for \fBnewfs\fR.
.sp
This option is not applicable for disks with EFI labels and is ignored.
.RE

Alternatively, parameters can be entered as a list of space-separated values
(without keywords) whose meaning is positional. In this case, the \fB-o\fR
option is omitted and the list follows the size operand. This is the way
\fBnewfs\fR passes the parameters to \fBmkfs\fR.
.RE

.SH OPERANDS
.sp
.LP
The following operands are supported:
.sp
.ne 2
.na
\fB\fIraw_device_file\fR\fR
.ad
.RS 19n
The disk partition on which to write.
.RE

.SH SEE ALSO
.sp
.LP
.BR ufs (4FS),
.BR dir_ufs (5),
.BR attributes (7),
.BR fsck (8),
.BR mkfs (8),
.BR newfs (8),
.BR tunefs (8)
.SH DIAGNOSTICS
.sp
.LP
The following error message typically occurs with very high density disks. On
such disks, the file system structure cannot encode the proper disk layout
information. However, such disks have enough onboard intelligence to make up
for any layout deficiencies, so there is no actual impact on performance. The
warning that performance might be impaired can be safely ignored.
.sp
.in +2
.nf
Warning: insufficient space in super block for
rotational layout tables with nsect \fIsblock.fs_nsect\fR
and ntrak \fIsblock.fs_ntrak\fR. (File system performance may be impaired.)
.fi
.in -2
.sp

.sp
.LP
The following error message occurs when the disk geometry results in a
situation where the last truncated cylinder group cannot contain the correct
number of data blocks. Some disk space is wasted.
.sp
.in +2
.nf
Warning: inode blocks/cyl group (\fIgrp\fR) >= data blocks (\fInum\fR) in last cylinder
.fi
.in -2
.sp

.sp
.LP
If there is only one cylinder group and if the above condition holds true,
\fBmkfs\fR fails with the following error:
.sp
.in +2
.nf
File system creation failed. There is only one cylinder group and that is
not even big enough to hold the inodes.
.fi
.in -2
.sp

.sp
.LP
The following error message occurs when the best calculated file system layout
is unable to include the last few sectors in the last cylinder group. This is
due to the interaction between how much space is used for various pieces of
meta data and the total blocks available in a cylinder group. Modifying
\fBnbpi\fR and \fBcpg\fR might reduce this number, but it is rarely worth the
effort.
.sp
.in +2
.nf
Warning: \fInum\fR sector(s) in last cylinder group unallocated
.fi
.in -2
.sp

.SH NOTES
.sp
.LP
You can use \fBlofiadm\fR to create a file that appears to the \fBmkfs\fR
command (for example, \fBmkfs_pcfs\fR or \fBmkfs_ufs\fR) as a raw device. You
can then use the \fBmkfs\fR command to create a file system on that device. See
\fBlofiadm\fR(8) for examples of creating a \fBUFS\fR and a \fBPC\fR
(\fBFAT\fR) file system on a device created by \fBlofiadm\fR.
.sp
.LP
Both the block and character devices, such as devices in \fB/dev/dsk\fR and
\fB/dev/rdsk\fR, must be available prior to running the \fBmkfs\fR command.
